listviews: Reset scrollbar adjustment when list is empty
authorCorey Berla <corey@berla.me>
Tue, 12 Jul 2022 19:42:28 +0000 (12:42 -0700)
committerCorey Berla <corey@berla.me>
Tue, 12 Jul 2022 19:54:35 +0000 (12:54 -0700)
commit94673707e63ee6533812bf0b9a1a7da23a8df0da
tree11ed18bfe1bc77b2a3d044e56cbd4d714c1dabd7
parent1e3ae95b7e607a494fd1863c852a1723e283c60a
listviews: Reset scrollbar adjustment when list is empty

In a list with a visible scrollbar, the scrollbar usually becomes
invisible when the numbers of items is less than the required amount
to scroll.  If, however, the list is emptied all at once,
the scrollbar remains.  This happens because when there's an empty
list gtk_list_view_size_allocate() returns early before the scrollbar
adjustment is updated.

Given that the list is empty, simply reset the adjustment values
to zero.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4370
gtk/gtkgridview.c
gtk/gtklistview.c